<template>
  <j-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
      
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="conName" label="容器名称">
          <a-input placeholder="请输入容器名称" v-model="model.conName" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="labelName" label="labelName">
          <a-input placeholder="请输入labelName" v-model="model.labelName" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="labelBak" label="labelBak">
          <a-input placeholder="请输入labelBak" v-model="model.labelBak" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="conWidth" label="容器宽度">
          <a-input placeholder="请输入容器宽度" v-model="model.conWidth" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="conType" label="容器类型">
          <a-input placeholder="请输入容器类型" v-model="model.conType" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pageId" label="页面id">
          <a-input placeholder="请输入页面id" v-model="model.pageId" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isLock" label="是否锁定">
          <a-input placeholder="请输入是否锁定" v-model="model.isLock" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fontSize" label="容器字体大小">
          <a-input placeholder="请输入容器字体大小" v-model="model.fontSize" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xName" label="容器x轴名字">
          <a-input placeholder="请输入容器x轴名字" v-model="model.xName" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yName" label="容器y轴名字">
          <a-input placeholder="请输入容器y轴名字" v-model="model.yName" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTiime" label="创建容器时间">
          <a-date-picker showTime valueFormat='YYYY-MM-DD HH:mm:ss' v-model="model.createTiime" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="deleteTime" label="删除容器时间">
          <a-date-picker showTime valueFormat='YYYY-MM-DD HH:mm:ss' v-model="model.deleteTime" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="delFlag" label="是否删除标志">
          <a-input placeholder="请输入是否删除标志" v-model="model.delFlag" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="creator" label="创建者">
          <a-input placeholder="请输入创建者" v-model="model.creator" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="updater" label="更新人">
          <a-input placeholder="请输入更新人" v-model="model.updater" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="conHeight" label="容器长度">
          <a-input placeholder="请输入容器长度" v-model="model.conHeight" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xmlIdSet" label="容器保存的ids表id">
          <a-input placeholder="请输入容器保存的ids表id" v-model="model.xmlIdSet" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cacheSet" label="播放时间单位 ">
          <a-input placeholder="请输入播放时间单位 " v-model="model.cacheSet" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subFlag" label="是否订阅">
          <a-input placeholder="请输入是否订阅" v-model="model.subFlag" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="downloadType" label="容器类型ip或存储下行">
          <a-input placeholder="请输入容器类型ip或存储下行" v-model="model.downloadType" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="grabf" label="容器频率">
          <a-input placeholder="请输入容器频率" v-model="model.grabf" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="frequency" label="容器频率">
          <a-input placeholder="请输入容器频率" v-model="model.frequency" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cacheSetBigint" label="cacheSetBigint">
          <a-input placeholder="请输入cacheSetBigint" v-model="model.cacheSetBigint" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="autoSet" label="autoSet">
          <a-input placeholder="请输入autoSet" v-model="model.autoSet" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="posterizeTime" label="posterizeTime">
          <a-input placeholder="请输入posterizeTime" v-model="model.posterizeTime" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="conOrder" label="conOrder">
          <a-input placeholder="请输入conOrder" v-model="model.conOrder" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fullview" label="fullview">
          <a-input placeholder="请输入fullview" v-model="model.fullview" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="miniview" label="miniview">
          <a-input placeholder="请输入miniview" v-model="model.miniview" />
        </a-form-model-item>
		
      </a-form-model>
    </a-spin>
  </j-modal>
</template>

<script>
  import { httpAction } from '@/api/manage'
  import moment from "moment"

  export default {
    name: "GdqvConModal",
    data () {
      return {
        title:"操作",
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },

        confirmLoading: false,
        validatorRules:{
        },
        url: {
          add: "/test/gdqvCon/add",
          edit: "/test/gdqvCon/edit",
        },
      }
    },
    created () {
    },
    methods: {
      add () {
        //初始化默认值
        this.edit({});
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.$refs.form.clearValidate();
      },
      handleOk () {
        const that = this;
        // 触发表单验证
         this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })
          }else{
             return false;
          }
        })
      },
      handleCancel () {
        this.close()
      },


    }
  }
</script>

<style lang="less" scoped>

</style>